//  理想视觉体重
import MeasureItem from './MeasureItem'
import Calc from './Calc'
import DateUtils from '../utils/DateUtils'
const UI = require('./UI')

export default class BestVisualWeightReport {
  /**
   * 理想视觉体重
   * <p>
   * 男性：（身高CM-100）* 0.9，女性：（身高CM-100）*0.8
   */
  static calcFfm(measure) {
    let weightControl;
    if (measure.gender == 1) {
      weightControl = (measure.height - 100) * 0.9;
    } else {
      weightControl = (measure.height - 100) * 0.8;
    }

    return weightControl;
  }

  static isEnable(measure) {
    return true
  }

  static build(measure) {

    let value = BestVisualWeightReport.calcFfm(measure)
    if (!value || value == 0) {
      return null;
    }
    value = +value.toFixed(2)
    const item = new MeasureItem()
    let desc = "根据您的身高和年龄，您的理想视觉体重是" + value + "kg";

    item.name = "理想视觉体重"
    item.value = value
    item.isStand = false
    item.unit = "kg"
    item.levelNames = ['偏低','标准']
    item.bar = [UI.color.report_lower, UI.color.report_stand]
    item.showBar = false
    item.desc = desc
    item.levelName = item.levelNames[item.level]
    item.levelColor = item.bar[item.level]
    return item
  }

}



// WEBPACK FOOTER //
// ./src/report/BestVisualWeight.js
